package com.member.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.member.mapper.ClazzMapper;
import com.member.po.Clazz;
import com.member.service.ClazzService;

public class ClazzServiceImpl implements ClazzService{
	@Autowired
	private ClazzMapper clazzMapper;

	//对传来的map容器进行处理
	public void setMap(Map map){
		if(map==null){
			return;
		}
		int pageNum = (int) map.get("pageNum");
		int size = (int) map.get("size");
		int startNum = (pageNum-1)*size;
		map.put("startNum", startNum);
	}
	
	public int countRows(Map map){
		this.setMap(map);
		return clazzMapper.countRows(map);
	}
	
	@Override
	public List<Clazz> select(Map map) {
		this.setMap(map);
		return clazzMapper.select(map);
	}

	@Override
	public Clazz selectById(int id) {
		return clazzMapper.selectById(id);
	}

	@Override
	public void insert(Clazz clazz) {
		clazzMapper.insert(clazz);
		System.out.println("service insert success");
	}

	@Override
	public void updateById(Clazz clazz) {
		clazzMapper.updateById(clazz);
		System.out.println("service update success");
	}

	@Override
	public void deleteById(int id) {
		clazzMapper.deleteById(id);
		System.out.println("service delete success");
	}


	
}
